﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MovieBrowser.Controller;
using MovieBrowser.Model;

namespace MovieBrowser.Presentation.Forms.Db
{
    public partial class PersonGridForm : Form
    {
        public MovieBrowserController Controller { get; set; }

        public PersonGridForm(MovieBrowserController controller, long id)
        {
            InitializeComponent();
            if (controller == null)
                controller = new MovieBrowserController();
            Controller = controller;
            personBindingSource.DataSource = Controller.Db.People.Where(o => o.Id == id);
        }

        private void PersonGridForm_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Controller.Db.SaveChanges();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
